package com.example.demo2.controller;



import com.example.demo2.entity.BloomTarget;
import com.example.demo2.entity.Target;

import com.example.demo2.service.BloomService;
import com.example.demo2.service.TargetService;
import com.google.gson.Gson;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/lv_Bloom")
public class BloomTargetController {
    @Autowired
    private BloomService bloomService;
//要注入对应的接口实现类，首先应该保证容器中有这样的类


    @RequestMapping("/FindAllBloomTarget")
    public String FindAllBloomTarget()
    {
//        用gson来完成数据传输

        List<BloomTarget> list=bloomService.Lv_selectAllBloomTarget();
        Gson gson = new Gson();
        return gson.toJson(list);
    }


    @RequestMapping("/FindBloomTargetById")
    public BloomTarget FindBloomTargetById(@Param("bulumuTarget") Integer bulumuTarget)
    {
        return bloomService.Lv_selectBloomByPrimaryKey(bulumuTarget);
    }


}
